Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Enable adding files #1864

Merged
merged 26 commits into from
Oct 14, 2024
Merged

feat: Enable adding files #1864

merged 26 commits into from
Oct 14, 2024

Conversation

mattzh72
Copy link
Collaborator

@mattzh72 mattzh72 commented Oct 10, 2024

Description

Enable adding files (refactored from documents). Specifically, this PR:

  • Defines data models for File objects
  • Supports storing files in SQL databases
  • Adds an API route to retrieve all the files associated with a source
  • Add pagination to API route

Also, adds some items to the .gitignore.

I ran alembic via the instructions:

poetry run alembic upgrade head
poetry run alembic revision --autogenerate -m "Add FileMetadata table and drop Documents table"

Testing

Added a test that loads the memgpt paper, retrieves the documents via the new API route, and confirms that:

  1. the correct number of files were made
  2. the metadata contains the right file name
  3. the sources are set correctly on the files

@mattzh72 mattzh72 requested a review from sarahwooders October 10, 2024 20:47
@mattzh72 mattzh72 changed the title Enable adding documents feat: Enable adding documents Oct 10, 2024
Copy link
Collaborator

@sarahwooders sarahwooders left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may want to rename this concept to a file, and associate it with an entire PDF (or file more generally) that gets uploaded.

.gitignore Show resolved Hide resolved
letta/config.py Outdated Show resolved Hide resolved
letta/data_sources/connectors.py Outdated Show resolved Hide resolved
letta/server/rest_api/routers/v1/sources.py Outdated Show resolved Hide resolved
@mattzh72 mattzh72 changed the title feat: Enable adding documents feat: Enable adding files Oct 10, 2024
@mattzh72 mattzh72 requested a review from sarahwooders October 10, 2024 23:17
@mattzh72 mattzh72 requested a review from sarahwooders October 10, 2024 23:33
letta/client/client.py Outdated Show resolved Hide resolved
letta/client/client.py Outdated Show resolved Hide resolved
letta/client/client.py Outdated Show resolved Hide resolved
letta/data_sources/connectors.py Outdated Show resolved Hide resolved
letta/data_sources/connectors.py Outdated Show resolved Hide resolved
letta/data_sources/connectors.py Outdated Show resolved Hide resolved
letta/schemas/file.py Outdated Show resolved Hide resolved
@mattzh72
Copy link
Collaborator Author

cc @4shub for correctness - I noticed it didn't mention dropping the Documents table or adding a new FileMetadata table - is this expected?

@4shub
Copy link
Collaborator

4shub commented Oct 13, 2024

This is correct, alembic only does any change on database deletions or modifications. You did not remove any database you just removed a scheme

@mattzh72 mattzh72 merged commit 9b34769 into main Oct 14, 2024
15 checks passed
@cpacker cpacker deleted the matt-add-documents branch October 16, 2024 03:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants